class TpshopLoginApi:
    # 1、 获取图片验证码接口
    @classmethod
    def get_image_code(cls, session):
        url ="http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=verify"
        # logging.info(f"获取图片验证码接口的URL={url}")
        resp = session.get(url)
        return resp

    # 2、 请求登录接口
    @classmethod
    def login(cls, session, username,password,verify_code):
        url = "http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=do_login"
        header = {"Content-Type": "application/x-www-form-urlencoded"}
        body = {"username": username, "password": password, "verify_code": verify_code}
        # logging.info(f"获取短信验证码接口的URL={url}")
        # logging.info(f"获取短信验证码接口的请求体body={body}")
        resp = session.post(url=url, headers=header, data=body)
        return resp